import graceJS from "@/Grace6/js/grace.js";
import {BASE_URL} from "@/config/app.js"
/**
 * 引入:import userUtils from "@/utils/user.js"
 */
export default {
	/**
	 * 用户头像
	 */
	headimg: (user_headimg_url) => {
		if (!user_headimg_url) {
			return BASE_URL + "/static/img/head_img/head.jpg";
		} else {
			return user_headimg_url
		}
	},

	/**
	 * 登录状态
	 */
	loginState: () => {
		return graceJS.getStorage('token') ? true : false;
	},

	/**
	 * 退出登录
	 */
	loginOut: () => {
		graceJS.removeStorage('token');
		uni.showToast({
			title: '您已安全退出~',
			duration: 3000,
			icon: "success"
		})
		setTimeout(() => {
			uni.navigateTo({
				url: '/pages/my/login'
			});
		}, 1000)
	},
}
